@model FunnelWeb.Web.Views.Wiki.SearchModel
@{
  if (Model.Is404) {
    Response.StatusCode = 404;
  }
  ViewBag.Title = "Search: " + Model.SearchText;
}

@section Summary {
  <p>
    A team of ninjas have scoured the land, looking for the results to your query. 
  </p>
}

<h1>Search Results: @Model.SearchText</h1>
      
@if (Model.Is404) {
<p>
  The page you requested does not exist. Below are some pages that may be related.
</p>
}
      
<div class="search-input">
  @using (Html.BeginForm("Search", "Wiki", FormMethod.Get)) {
  <label for="q">Search again:</label> @Html.TextBox("q", Model.SearchText, new { @class="large" })
  <input type="submit" id="research" class="submit" value="Search" />
  }
</div>
      
@if (Model.Results.Count() == 0) {
  <p>
    Sorry, there were no results for your query.
  </p>
} else {
<div class="search-list">
  @foreach (var entry in Model.Results) {
  <div class='search-line'>
    <h2>@Html.Qualify(Html.ActionLink(entry.Title, "Page", new { page = entry.Name }))</h2>
    @if (!string.IsNullOrEmpty(entry.MetaDescription)) {
    <p>@entry.MetaDescription)</p>
    }
    <div class='revised'>
      <span class='month'>@entry.Published.ToString("MMM d")</span> 
      <span class='year'>@entry.Published.ToString("yyyy")</span>
    </div>
  </div>
  }
</div>
}
